﻿using MemberPoint.Business;
using MemberPoint.Entity.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MPMCDC.Controllers
{
    public class GiftsController : Controller
    {
        // GET: Gifts
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public ActionResult IndexGifts()
        {
            return View();
        }
        /// <summary>
        /// 显示礼品列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetGiftss(GiftSViewModel Gifts)
        {
            GiftsService _GiftsService = new GiftsService();
            var list = _GiftsService.GetGifts(Gifts);
            return Json(list.Data);
        }
        /// <summary>
        /// 添加礼品
        /// </summary>
        /// <returns></returns>
        public ActionResult GiftsInsert()
        {
            return View();
        }
        [HttpPost]
        public ActionResult GiftsInsert(GiftSViewModel Gifts)
        {
            GiftsService _GiftsService = new GiftsService();
            var list = _GiftsService.GetAddGifts(Gifts);
            return Json(list);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns></returns>
        public ActionResult GiftsUpdate(int id)
        {
            GiftsService _GiftsService = new GiftsService();
            var list = _GiftsService.GetUpdateGifts(id).Data;
            return View("GiftsInsert", list);
        }
        [HttpPost]
        public ActionResult GiftsUpdate(GiftSViewModel Gifts)
        {
            GiftsService _GiftsService = new GiftsService();
            var list = _GiftsService.GetUpdateGifts(Gifts);
            return Json(list);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Gifts"></param>
        /// <returns></returns>
        public ActionResult Delete(int EG_ID)
        {
            GiftsService _GiftsService = new GiftsService();
            var list = _GiftsService.Delete(EG_ID);
            return Json(list);
        }

    }
}